﻿using System;

class CorrectBrackets
{
    static void Main()
    {
        //Exercise 3.
        //Write a program to check if in a given expression the brackets are put correctly.
        //Example of correct expression: ((a+b)/5-d).
        //Example of incorrect expression: )(a+b)).

        //string text = "((a+b)/5-d)";
        Console.Write("Enter a string: ");
        string text = Console.ReadLine();
        int counter = 0;
        for (int i = 0; i < text.Length; i++)
        {
            if (text[i] == '(')
            {
                counter++;
            }
            else if (text[i] == ')')
            {
                counter--;
            }
        }
        if (counter == 0)
        {
            Console.WriteLine("The brackets are put correctly.");
        }
        else
        {
            Console.WriteLine("The brackets are NOT put correctly.");
        }
    }
}

